package com.d3works.apps.base.web;

import com.d3works.apps.base.db.Querie;
import com.d3works.apps.base.exceptions.BaseExceptionMessage;
import com.d3works.apps.base.service.querie.QuerieService;
import com.d3works.exception.service.TraceBackService;
import com.d3works.i18n.I18n;
import com.d3works.inject.Beans;
import com.d3works.rpc.ActionRequest;
import com.d3works.rpc.ActionResponse;
import com.google.inject.Singleton;

@Singleton
public class QuerieController {

  public void checkQuerie(ActionRequest request, ActionResponse response) {

    try {
      Beans.get(QuerieService.class).checkQuerie(request.getContext().asType(Querie.class));
      response.setInfo(I18n.get(BaseExceptionMessage.QUERIE_3));
    } catch (Exception e) {
      TraceBackService.trace(response, e);
    }
  }
}
